From: Florian Müllner Date: Sun, 13 Aug 2023 17:12:27 +0000 (+0200) Subject: extensions/shared: Don't cache detected URL X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~320^2^2~106 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=af5dd7ddd178f5841e13d4e61f7947ed04ad8331;p=gnome-shell.git extensions/shared: Don't cache detected URL The translation functions we export from extension utils must work with all extensions, not only the first that calls one of the functions. That means that we are back to examining a backtrace for every function call unless an extension defined its own translation functions with `import.meta.url`. Part-of: --- diff --git a/js/extensions/sharedInternals.js b/js/extensions/sharedInternals.js index 7fed3812a..c9cb8e9c8 100644 --- a/js/extensions/sharedInternals.js +++ b/js/extensions/sharedInternals.js @@ -218,10 +218,8 @@ export class GettextWrapper { } #lookupExtension(funcName) { - if (!this.#url) - this.#url = this.#detectUrl(); - - const extension = this.#extensionClass.lookupByURL(this.#url); + const url = this.#url ?? this.#detectUrl(); + const extension = this.#extensionClass.lookupByURL(url); if (!extension) throw new Error(`${funcName} can only be called from extensions`); return extension;